//File:			MartixMath.h
//Purpose:		To provide a standard way of transforming, rotating, and defining 4x4 matricies.
//Programmer:	Daniel Martin 4/19/2013

#pragma once
#include <iostream>
#include <array>
#include <cmath>
const float  PI_F = 3.14159265358979f;

class Vec3
{
public:
	float	X,Y,Z;

	Vec3();
	Vec3(float x, float y, float z);
	Vec3(float Fill_Value);

	bool operator == (Vec3 V);
	Vec3 operator *  (float Scalar);
	Vec3 operator +  (float Scalar);
	Vec3 operator -  (float Scalar);
	Vec3 operator /  (float Scalar);

	Vec3 operator *  (Vec3 Vec);
	Vec3 operator +  (Vec3 Vec);
	Vec3 operator -  (Vec3 Vec);
	Vec3 operator /  (Vec3 Vec);

	float	Dot(Vec3 V);
	float	Length();
	Vec3	CrossProduct(Vec3 V);
	float	AngleBetween(Vec3 V);
	bool	IsOrthogonal(Vec3 V);
	bool	IsColinear(Vec3 V);

	Vec3	Normalized();
	Vec3	Unit();

	void Fill(float Fill_Value);

	void Cout_Print();
};


class Mat4
{
public:
	float Mat[4][4];
	float Mat16[16];

	Mat4();
	~Mat4();

	void Fill(float Val);
	void Fill_Addition(float StartingNumber, float Increment);

	void Transform(Vec3 _Vector);
	void SetPos(Vec3 _Vector);

	void Rotate(Vec3 _Angle);
	void Rotate_X(float Degree);
	void Rotate_Y(float Degree);
	void Rotate_Z(float Degree);

	void Identity();
	void Identity_Perspective();

	float* SetMat16();
	std::array<float,16> Get_Mat16();
	void Cout_Print();

	void Scale(Vec3 Scale);
	void SetScale(Vec3 Scale);


	void Orthographic(float Left, float Right, float Top, float Bottom, float Near, float Far);
	void Perspective(float fovy, float aspect, float zNear, float zFar);

	void SetMatrix(Mat4 NewMatrixValues);

	Mat4 Multiply(Mat4 Mult);

	Mat4 operator * (Mat4 Mult);
	void operator = (Mat4 M);
};


class LinearMath
{
public:

	static float DegreeToRad(float Degree);

};